<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <title>Edit ${title}</title>
  </head>
  <body>
    <div class="nav">
      <span class="menuButton"><g:link class="list" action="select">List All Types</g:link></span>
      <span class="menuButton"><g:link class="list" action="list">${title} List</g:link></span>
      <span class="menuButton"><g:link class="create" action="create">New ${title}</g:link></span>
    </div>
    <div class="body">
      <h1>Edit ${title}</h1>
      <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
      </g:if>
      <g:hasErrors bean="${type}">
        <div class="errors">
          <g:renderErrors bean="${type}" as="list" />
        </div>
      </g:hasErrors>
      <g:form method="post" >
        <input type="hidden" name="id" value="${title}" />
        <input type="hidden" name="index" value="${type?.id}" />
        <input type="hidden" name="version" value="${type?.version}" />
        <div class="dialog">
          <table>
            <tbody>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="name">Name:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:type,field:'name','errors')}">
                  <input type="text" id="name" name="name" value="${fieldValue(bean:type,field:'name')}"/>
                </td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name">
                  <label for="description">Description:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean:type,field:'description','errors')}">
                  <input type="text" id="description" name="description" value="${fieldValue(bean:type,field:'description')}"/>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="buttons">
          <span class="button"><g:actionSubmit class="save" value="Update" /></span>
          <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure you want to delete the ' + '${title}' + ' named ' + '${type.name}?');" value="Delete" /></span>
        </div>
      </g:form>
    </div>
  </body>
</html>
